﻿Imports ccapps.persistent.LACustomerDetailsEdit
Public Class LACustomerDetailsEdit
    Inherits [lib].BasePage
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.PageTitle = "LA Müşteri Güncelleme"
    End Sub



    Protected Sub btnCustcodeSearch_Click(sender As Object, e As EventArgs) Handles btnCustcodeSearch.Click
        TB_SearchMSISDN.Text = ""
        Clear()
       


        Dim pin_SearchCustcode As String = TB_SearchCustcode.Text
        Dim dt As DataTable = GetCustInfoFromCustcode(pin_SearchCustcode)
        Dim dt2 As DataTable = ccapps.persistent.LACustomerDetails.CustControl(pin_SearchCustcode)
        If dt2.Rows.Count > 0 Then
            If Not dt2.Rows(0)(0).ToString = "CORP" Then
                Me.Page.RegisterStartupScript("javascript", "<script language=""javascript"">alert('Sadece LA Customer ile İşlem Yapabilirsiniz.');</script>")
            Else
                If dt.Rows.Count > 0 Then
                    For Each dr2 As DataRow In dt.Rows


                        lblCustomerID.Text = dr2("CUSTOMER_ID").ToString()


                        ErrorMessage.Text = ""
                    Next
                    'If Not (Convert.ToInt32(dtcustcontrol.Rows(0)(0)) = 10 OrElse Convert.ToInt32(dtcustcontrol.Rows(0)(0)) = 20 OrElse Convert.ToInt32(dtcustcontrol.Rows(0)(0)) = 30) Then
                    '    Me.Page.RegisterStartupScript("javascript", "<script language=""javascript"">alert('Sadece LA Customer ile İşlem Yapabilirsiniz.');</script>")

                    FillIDTypeList()
                    FillLanguage()
                    FillNationality()
                    FillSector()




                Else
                    ErrorMessage.Text = "Girmiş olduğunuz Custcode'a ait veri bulunamamıştır."


                End If
            End If
        Else
            ErrorMessage.Text = "Girmiş olduğunuz Custcode'a ait veri bulunamamıştır."
        End If

        


      
    End Sub

    Private Sub FillIDTypeList()

        DDL_IDTYPE.Items.Clear()
        Dim dt As DataTable = GetIDTypeList()

        If dt.Rows.Count > 0 Then
            For Each dr As DataRow In dt.Rows
                DDL_IDTYPE.Items.Add(New ListItem(dr("IDTYPE_NAME").ToString(), dr("IDTYPE_CODE").ToString()))
            Next
        End If
    End Sub

    Private Sub FillNationality()

        DDL_Nationality.Items.Clear()
        Dim dt As DataTable = GetNationality()

        If dt.Rows.Count > 0 Then
            For Each dr As DataRow In dt.Rows
                DDL_Nationality.Items.Add(New ListItem(dr("Country_Name").ToString(), dr("COUNTRY_ID").ToString()))
            Next
        End If
    End Sub


    Private Sub FillLanguage()

        DDL_Language.Items.Clear()

        Dim dt As DataTable = GetLanguage()

        If dt.Rows.Count > 0 Then
            For Each dr As DataRow In dt.Rows
                DDL_Language.Items.Add(New ListItem(dr("LNG_DES").ToString(), dr("LNG_ID").ToString()))
            Next
        End If
    End Sub

    Private Sub FillSector()

        DDL_Sector.Items.Clear()
        Dim dt As DataTable = GetSectorList()

        If dt.Rows.Count > 0 Then
            For Each dr As DataRow In dt.Rows
                DDL_Sector.Items.Add(New ListItem(dr("tradename").ToString(), dr("tradecode").ToString()))
            Next
        End If
    End Sub

    Protected Sub btnMSISDNSearch_Click(sender As Object, e As EventArgs) Handles btnMSISDNSearch.Click
        TB_SearchCustcode.Text = ""
        Clear()
       
        Dim pin_SearchMSISDN As String = TB_SearchMSISDN.Text.Trim()
        Dim dt As DataTable = GetCustInfoFromMSISDN(pin_SearchMSISDN)
        Dim dt6 As DataTable = ccapps.persistent.LACustomerDetails.getCustCode(pin_SearchMSISDN)
        Dim custCode As String = dt6.Rows(0)(0).ToString()

        Dim dtcustcontrol As DataTable = ccapps.persistent.LACustomerDetails.CustControl(custCode)

        If Not dtcustcontrol.Rows(0)(0).ToString = "CORP" Then
            Me.Page.RegisterStartupScript("javascript", "<script language=""javascript"">alert('Sadece LA Customer ile İşlem Yapabilirsiniz.');</script>")
        Else
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows


                    lblCustomerID.Text = dr2("CUSTOMER_ID").ToString()

                    ErrorMessage.Text = ""
                Next

                FillIDTypeList()
                FillLanguage()
                FillNationality()
                FillSector()


            Else
                ErrorMessage.Text = "Girmiş olduğunuz MSISDN'e ait veri bulunamamıştır."

        End If
        End If


        


    End Sub


    Protected Sub btnGetInfo_Click(sender As Object, e As EventArgs) Handles btnGetInfo.Click
        Try

            Dim pin_customer_id As Integer
            pin_customer_id = Convert.ToInt32(lblCustomerID.Text)

            tblContactInfo.Visible = True

            Dim dt As DataTable = GetCustomerContactDetails(pin_customer_id)
            Dim data_level As Integer


            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows

                    TB_CustCode.Text = dr2("CUSTCODE").ToString()
                    TB_CompanyName.Text = dr2("CCNAME").ToString()
                    TB_Status.Text = dr2("Status").ToString()
                    TB_TaxOffice.Text = dr2("CSCOMPREGNO").ToString()
                    TB_TaxNumber.Text = dr2("CSCOMPTAXNO").ToString()
                    TB_Tariff.Text = dr2("rateplan").ToString()
                    TB_PriceGroup.Text = dr2("pricegroup").ToString()
                    TB_DealerID.Text = dr2("DEALER_ID").ToString()
                    TB_AuthorizedPersonMSISDN.Text = dr2("CCSMSNO").ToString()
                    TB_AuthorizedPersonName.Text = dr2("CCFNAME").ToString() + " " + dr2("CCLNAME").ToString()
                    TB_AuthorizedPersonEmail.Text = dr2("CCEMAIL").ToString()
                    If dr2("CS_DATA_LEVEL").ToString() <> "" And dr2("CS_DATA_LEVEL").ToString() <> Nothing And IsDBNull(dr2("CS_DATA_LEVEL").ToString()) Then
                        data_level = Convert.ToInt32(dr2("CS_DATA_LEVEL").ToString())
                        If data_level = 1 Then
                            TB_TCNo.Enabled = False
                            'btnTCNo.Enabled = False
                        End If
                    End If

                    TB_TCNo.Text = dr2("CSTCIDNUMBER").ToString()

                    If (IsDBNull(DDL_IDTYPE.SelectedValue) <> True) Then
                        DDL_IDTYPE.SelectedValue = dr2("IDType_CODE").ToString()
                    Else
                        DDL_IDTYPE.Items.Add(New ListItem("", "bos"))
                        DDL_IDTYPE.SelectedValue = "bos"
                    End If

                    TB_IdentificationNo.Text = dr2("PASSPORTNO").ToString()

                    TB_AuthorizedPersonBirthdate.Text = dr2("BIRTHDATE").ToString().Substring(0, 10)
                    TB_AuthorizedPersonFatherName.Text = dr2("csremark_1").ToString()
                    'If dr2("TradeCode").ToString() <> "" And dr2("TradeCode").ToString() <> Nothing And IsDBNull(dr2("TradeCode").ToString()) Then
                    '    DDL_Sector.SelectedValue = Convert.ToInt32(dr2("TradeCode").ToString())
                    '    Label1.Text = dr2("TradeCode").ToString()
                    'Else
                    '    DDL_Sector.Items.Add(New ListItem("", "bos"))
                    '    DDL_Sector.SelectedValue = "bos"

                    'End If
                    If (dr2("INDIVIDUAL_OVERDISC_FLAG").ToString() = "X") Then
                        chckDeactiveOverdiscounting.Checked = True
                    Else
                        chckDeactiveOverdiscounting.Checked = False
                    End If

                    If (dr2("SUPPRESS_INV_EXEMPTION_FLAG").ToString() = "X") Then
                        chckLimitAltiFatura.Checked = True
                    Else
                        chckLimitAltiFatura.Checked = False
                    End If


                    TB_NAME.Text = dr2("CCNAME").ToString()
                    TB_FNAME.Text = dr2("CCFNAME").ToString()
                    TB_LNAME.Text = dr2("CCLNAME").ToString()
                    TB_STREET.Text = dr2("ccstreet").ToString()
                    TB_STREETNO.Text = dr2("ccstreetno").ToString()
                    TB_ADR1.Text = dr2("ccaddr1").ToString()
                    TB_ADR2.Text = dr2("ccaddr2").ToString()
                    TB_ADR3.Text = dr2("ccaddr3").ToString()
                    TB_ZIP.Text = dr2("CCZIP").ToString()
                    TB_CITY.Text = dr2("CCCITY").ToString()
                    TB_ContactPhoneArea1.Text = dr2("cctn_area").ToString()
                    TB_ContactPhone1.Text = dr2("cctn").ToString()
                    TB_ContactPhoneArea2.Text = dr2("cctn2_area").ToString()
                    TB_ContactPhone2.Text = dr2("cctn2").ToString()
                    TB_FaxNoArea.Text = dr2("CCFAX_AREA").ToString()
                    TB_FaxNo.Text = dr2("CCFAX").ToString()
                    TB_Email.Text = dr2("CCEMAIL").ToString()
                    TB_SMSNo.Text = dr2("CCSMSNO").ToString()
                    TB_DriverLicenceNo.Text = dr2("CSDRIVELICENCE").ToString()
                    If dr2("LanguageCode").ToString() <> "" And dr2("LanguageCode").ToString() <> Nothing Then
                        DDL_Language.SelectedValue = Convert.ToInt32(dr2("LanguageCode").ToString())
                    Else
                        DDL_Language.Items.Add(New ListItem("", "bos"))
                        DDL_Language.SelectedValue = "bos"
                    End If

                    If dr2("CountryCode").ToString() <> "" And dr2("CountryCode").ToString() <> Nothing Then
                        DDL_Nationality.SelectedValue = Convert.ToInt32(dr2("CountryCode").ToString())

                    Else
                        DDL_Nationality.Items.Add(New ListItem("", "bos"))
                        DDL_Nationality.SelectedValue = "bos"
                    End If
                    DDL_CustomerType.SelectedValue = dr2("CSPERSONTYPE").ToString()
                    'TB_DataLevel.Text = dr2("CS_DATA_LEVEL").ToString()
                    TB_FatherName.Text = dr2("csremark_1").ToString()
                    TB_MotherName.Text = dr2("mothers_name").ToString()
                    TB_MotherMaidenName.Text = dr2("csremark_2").ToString()
                    TB_RegistiredProvince.Text = dr2("REGISTERED_PROVINCE").ToString()
                    TB_RegistiredDistrict.Text = dr2("REGISTERED_DISTRICT").ToString()
                    TB_BirthPlaceProvince.Text = dr2("BIRTH_PLACE_PROVINCE").ToString()
                    TB_BirthPlaceDistrict.Text = dr2("BIRTH_PLACE_DISTRICT").ToString()

                    If (dr2("CS_DATA_SHARE").ToString() = "X") Then
                        chckDataShare.Checked = True
                    Else
                        chckDataShare.Checked = False
                    End If
                    TB_Employer.Text = dr2("CSEMPLOYER").ToString()
                    If (dr2("EMPLOYEE").ToString() = "X") Then
                        chckEmployeeOfYourCompany.Checked = True
                    Else
                        chckEmployeeOfYourCompany.Checked = False
                    End If
                    ErrorMessage.Text = ""



                Next
                If dt.Rows(0)("TradeCode").ToString() <> "" Then
                    DDL_Sector.SelectedValue = dt.Rows(0)("TradeCode").ToString()

                Else
                    DDL_Sector.Items.Add(New ListItem("", "bos"))
                    DDL_Sector.SelectedValue = "bos"

                End If
                Dim dtgetLaprint As DataTable = GetCustomerLaPrint(Convert.ToInt32(lblCustomerID.Text))
                If dtgetLaprint.Rows.Count > 0 Then
                    If Convert.ToInt32(dtgetLaprint.Rows(0)(0)) = 1 Then
                        chckPrintInvoice.Checked = True
                    Else
                        chckPrintInvoice.Checked = False

                    End If
                    


                End If


            Else
                ErrorMessage.Text = "Girmiş oldugunuz değere ait veri bulunamamıştır"

            End If
        Catch ex As Exception

        End Try



       


    End Sub

    Protected Sub btnTaxOffice_Click(sender As Object, e As EventArgs) Handles btnTaxOffice.Click

        Try

            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim taxOffice As String = TB_TaxOffice.Text

            Dim dt As DataTable = UpdateTaxOffice(pin_customer_id, taxOffice)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub


    Protected Sub btnTaxNumber_Click(sender As Object, e As EventArgs) Handles btnTaxNumber.Click
        Try

            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim taxNumber As String = TB_TaxNumber.Text

            Dim dt As DataTable = UpdateTaxNumber(pin_customer_id, taxNumber)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If
        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try


    End Sub

    Protected Sub btnAuthorizedPersonMSISDN_Click(sender As Object, e As EventArgs) Handles btnAuthorizedPersonMSISDN.Click
        Try

            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim AuthorizedPersonMSISDN As String = TB_AuthorizedPersonMSISDN.Text

            Dim dt As DataTable = UpdateAuthorizedMSISDN(pin_customer_id, AuthorizedPersonMSISDN)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If
        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try

    End Sub

    Protected Sub btnAuthorizedPersonEmail_Click(sender As Object, e As EventArgs) Handles btnAuthorizedPersonEmail.Click
        Try


            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim AuthorizedPersonEmail As String = TB_AuthorizedPersonEmail.Text

            Dim dt As DataTable = UpdateAuthorizedEmail(pin_customer_id, AuthorizedPersonEmail)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    'Protected Sub btnTCNo_Click(sender As Object, e As EventArgs) Handles btnTCNo.Click
    '    Try

    '        Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
    '        Dim TCNo As String = TB_TCNo.Text

    '        Dim dt As DataTable = UpdateTCNo(pin_customer_id, TCNo)
    '        If dt.Rows.Count > 0 Then
    '            For Each dr2 As DataRow In dt.Rows
    '                If (dr2("result").ToString() = "0") Then

    '                    Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

    '                Else
    '                    Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
    '                End If
    '            Next
    '        End If
    '    Catch ex As Exception


    '        Session("message") = ex.Message
    '        Response.Clear()
    '        Response.Status = "302 Object Moved"
    '        Response.RedirectLocation = "CX_Exception.aspx"
    '        Response.End()




    '    End Try

    'End Sub




    Protected Sub btnDeactiveOverdiscounting_Click(sender As Object, e As EventArgs) Handles btnDeactiveOverdiscounting.Click
        Try

            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)

            Dim Deactive As String
            If chckDeactiveOverdiscounting.Checked = True Then
                Deactive = "Y"
            Else
                Deactive = "N"
            End If


            Dim dt As DataTable = UpdateDeactivateOverdisc(pin_customer_id, Deactive)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "OK") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If
        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnLimitAltiFatura_Click(sender As Object, e As EventArgs) Handles btnLimitAltiFatura.Click

        Try

            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)

            Dim limitAlti As String
            If chckLimitAltiFatura.Checked = True Then
                limitAlti = "Y"
            Else
                limitAlti = "N"
            End If


            Dim dt As DataTable = UpdateLimitAltiFatura(pin_customer_id, limitAlti)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnCustomerStreet_Click(sender As Object, e As EventArgs) Handles btnCustomerStreet.Click

        Try

            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim street As String = TB_STREET.Text.Trim()

            Dim dt As DataTable = UpdateCustomerStreet(pin_customer_id, street)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub


    Protected Sub btnCustomerStreetNo_Click(sender As Object, e As EventArgs) Handles btnCustomerStreetNo.Click
        Try

            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim street As String = TB_STREETNO.Text.Trim()

            Dim dt As DataTable = UpdateCustomerStreetNo(pin_customer_id, street)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnADR1_Click(sender As Object, e As EventArgs) Handles btnADR1.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim adr1 As String = TB_ADR1.Text.Trim()

            Dim dt As DataTable = UpdateCustomerADR1(pin_customer_id, adr1)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If
        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnADR2_Click(sender As Object, e As EventArgs) Handles btnADR2.Click

        Try

            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim adr2 As String = TB_ADR2.Text.Trim()

            Dim dt As DataTable = UpdateCustomerADR2(pin_customer_id, adr2)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnADR3_Click(sender As Object, e As EventArgs) Handles btnADR3.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim adr3 As String = TB_ADR3.Text.Trim()

            Dim dt As DataTable = UpdateCustomerADR3(pin_customer_id, adr3)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnZIP_Click(sender As Object, e As EventArgs) Handles btnZIP.Click
        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim zip As String = TB_ZIP.Text.Trim()

            Dim dt As DataTable = UpdateCustomerZIP(pin_customer_id, zip)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub bntCity_Click(sender As Object, e As EventArgs) Handles bntCity.Click
        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim city As String = TB_CITY.Text.Trim()

            Dim dt As DataTable = UpdateCustomerCity(pin_customer_id, city)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnContactPhone1_Click(sender As Object, e As EventArgs) Handles btnContactPhone1.Click
        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim phonearea As String = TB_ContactPhoneArea1.Text.Trim()
            Dim phone As String = TB_ContactPhone1.Text.Trim()

            Dim dt As DataTable = UpdateContactPhone1(pin_customer_id, phonearea, phone)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnTB_ContactPhone2_Click(sender As Object, e As EventArgs) Handles btnTB_ContactPhone2.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim phonearea As String = TB_ContactPhoneArea2.Text.Trim()
            Dim phone As String = TB_ContactPhone2.Text.Trim()

            Dim dt As DataTable = UpdateContactPhone2(pin_customer_id, phonearea, phone)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnFaxNo_Click(sender As Object, e As EventArgs) Handles btnFaxNo.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim faxarea As String = TB_FaxNoArea.Text.Trim()
            Dim fax As String = TB_FaxNo.Text.Trim()

            Dim dt As DataTable = UpdateFax(pin_customer_id, faxarea, fax)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnEmail_Click(sender As Object, e As EventArgs) Handles btnEmail.Click
        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim email As String = TB_Email.Text.Trim()


            Dim dt As DataTable = UpdateEmail(pin_customer_id, email)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnSMSNo_Click(sender As Object, e As EventArgs) Handles btnSMSNo.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim sms As String = TB_SMSNo.Text.Trim()


            Dim dt As DataTable = UpdateSMSNo(pin_customer_id, sms)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If
        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnDriverLicenceNo_Click(sender As Object, e As EventArgs) Handles btnDriverLicenceNo.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim driver As String = TB_DriverLicenceNo.Text.Trim()


            Dim dt As DataTable = UpdateDriverLicence(pin_customer_id, driver)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If
        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnRegistiredProvince_Click(sender As Object, e As EventArgs) Handles btnRegistiredProvince.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim regPro As String = TB_RegistiredProvince.Text.Trim()


            Dim dt As DataTable = UpdateRegistiredProvince(pin_customer_id, regPro)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnRegistiredDistrict_Click(sender As Object, e As EventArgs) Handles btnRegistiredDistrict.Click
        Try

            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim regdis As String = TB_RegistiredDistrict.Text.Trim()


            Dim dt As DataTable = UpdateRegistiredDistrict(pin_customer_id, regdis)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnBirthPlaceProvince_Click(sender As Object, e As EventArgs) Handles btnBirthPlaceProvince.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim birthPro As String = TB_BirthPlaceProvince.Text.Trim()


            Dim dt As DataTable = UpdateBirthPlaceProvince(pin_customer_id, birthPro)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnBirthPlaceDistrict_Click(sender As Object, e As EventArgs) Handles btnBirthPlaceDistrict.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim birthDis As String = TB_BirthPlaceDistrict.Text.Trim()


            Dim dt As DataTable = UpdateBirthPlaceDistrict(pin_customer_id, birthDis)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnEmployer_Click(sender As Object, e As EventArgs) Handles btnEmployer.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim employer As String = TB_Employer.Text.Trim()


            Dim dt As DataTable = UpdateEmployer(pin_customer_id, employer)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnDataShare_Click(sender As Object, e As EventArgs) Handles btnDataShare.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)

            Dim dataShare As String
            If chckDataShare.Checked = True Then
                dataShare = "Y"
            Else
                dataShare = "N"
            End If


            Dim dt As DataTable = UpdateDataShare(pin_customer_id, dataShare)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnEmployeeOfYourCompany_Click(sender As Object, e As EventArgs) Handles btnEmployeeOfYourCompany.Click
        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)

            Dim EmployeeOfYourCompany As String
            If chckEmployeeOfYourCompany.Checked = True Then
                EmployeeOfYourCompany = "Y"
            Else
                EmployeeOfYourCompany = "N"
            End If


            Dim dt As DataTable = UpdateEmployeeCompany(pin_customer_id, EmployeeOfYourCompany)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If
        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnLanguage_Click(sender As Object, e As EventArgs) Handles btnLanguage.Click
        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim lang As Integer = Convert.ToInt32(DDL_Language.SelectedValue)


            Dim dt As DataTable = UpdateLanguage(pin_customer_id, lang)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnNationality_Click(sender As Object, e As EventArgs) Handles btnNationality.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim national As Integer = Convert.ToInt32(DDL_Nationality.SelectedValue)


            Dim dt As DataTable = UpdateNationality(pin_customer_id, national)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnCustomerType_Click(sender As Object, e As EventArgs) Handles btnCustomerType.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim type As String = DDL_CustomerType.SelectedValue


            Dim dt As DataTable = UpdateCustomerType(pin_customer_id, type)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnSector_Click(sender As Object, e As EventArgs) Handles btnSector.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim sector As String = DDL_Sector.SelectedValue


            Dim dt As DataTable = UpdateSector(pin_customer_id, sector)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If

        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub

    Protected Sub btnIdentificationNo_Click(sender As Object, e As EventArgs) Handles btnIdentificationNo.Click

        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)
            Dim id_type As String = DDL_IDTYPE.SelectedValue
            Dim idno As String = TB_IdentificationNo.Text


            Dim dt As DataTable = UpdateIdentificationTypeAndNo(pin_customer_id, idno, id_type)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If
        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub


    Private Sub Clear()

        TB_CustCode.Text = ""
        TB_CompanyName.Text = ""
        TB_Status.Text = ""
        TB_TaxOffice.Text = ""
        TB_TaxNumber.Text = ""
        TB_Tariff.Text = ""
        TB_PriceGroup.Text = ""
        TB_DealerID.Text = ""
        TB_AuthorizedPersonMSISDN.Text = ""
        TB_AuthorizedPersonName.Text = ""
        TB_AuthorizedPersonEmail.Text = ""
        TB_TCNo.Text = ""
        DDL_IDTYPE.Items.Clear()
        TB_IdentificationNo.Text = ""
        TB_AuthorizedPersonBirthdate.Text = ""
        TB_AuthorizedPersonFatherName.Text = ""
        DDL_Sector.Items.Clear()
        chckDeactiveOverdiscounting.Checked = False
        chckLimitAltiFatura.Checked = False
        TB_NAME.Text = ""
        TB_FNAME.Text = ""
        TB_LNAME.Text = ""
        TB_STREET.Text = ""
        TB_STREETNO.Text = ""
        TB_ADR1.Text = ""
        TB_ADR2.Text = ""
        TB_ADR3.Text = ""
        TB_ZIP.Text = ""
        TB_CITY.Text = ""
        TB_ContactPhoneArea1.Text = ""
        TB_ContactPhone1.Text = ""
        TB_ContactPhoneArea2.Text = ""
        TB_ContactPhone2.Text = ""
        TB_FaxNoArea.Text = ""
        TB_FaxNo.Text = ""
        TB_Email.Text = ""
        TB_SMSNo.Text = ""
        TB_DriverLicenceNo.Text = ""
        DDL_Language.Items.Clear()
        DDL_Nationality.Items.Clear()
        'DDL_CustomerType.SelectedValue = ""
        TB_FatherName.Text = ""
        TB_MotherName.Text = ""
        TB_MotherMaidenName.Text = ""
        TB_RegistiredProvince.Text = ""
        TB_RegistiredDistrict.Text = ""
        TB_BirthPlaceProvince.Text = ""
        TB_BirthPlaceDistrict.Text = ""
        chckDataShare.Checked = False
        TB_Employer.Text = ""
        chckEmployeeOfYourCompany.Checked = False
        Label1.Text = ""

    End Sub

    Protected Sub btnLaPrintInvoice_Click(sender As Object, e As EventArgs) Handles btnLaPrintInvoice.Click
        Dim status As Integer
        If chckPrintInvoice.Checked = True Then
            status = 1
        Else
            status = 0


        End If

        Dim dt As DataTable = LAPrintInvoice(Convert.ToInt32(lblCustomerID.Text), status)
        If dt.Rows.Count > 0 Then
            If Convert.ToInt32(dt.Rows(0)(0)) = 1 Then
                Label1.Text = "İşlem Başarıyla Gerçekleşti"
            Else
                Label1.Text = "Güncelleme işlemi Başarısız oldu"


            End If


        End If



    End Sub

    Protected Sub btnIdentificationNo0_Click(sender As Object, e As EventArgs) Handles btnIdentificationNo0.Click
        If TB_TCNo.Text = "" Then
            Me.Page.RegisterStartupScript("javascript", "<script language=""javascript"">alert('TC No Alanı Boş Değer İçermez.');</script>")
        Else
            Try
                Label1.Text = ""
                Dim d As Double = Double.Parse(TB_TCNo.Text)
                If TB_TCNo.Text.Length = 11 Then
                    Dim name, surname, gender, fatherName, birthDay, birthMonth, birthYear, cityName, countyName, anneKizlikSoyad, birthPlace As String

                    If (persistent.ChangeSIMpersistence.CheckMernisStatus2(TB_TCNo.Text, name, surname, gender, fatherName, birthDay, birthMonth, birthYear, cityName, countyName, anneKizlikSoyad, birthPlace) = "0") Then


                        lblTcIdControlError.Text = "Geçerli TC No"
                        TB_AuthorizedPersonName.Text = NullControl(name)
                        TB_FNAME.Text = NullControl(name)
                        TB_LNAME.Text = NullControl(surname)
                        TB_NAME.Text = NullControl(name)
                        TB_FatherName.Text = NullControl(fatherName)
                        TB_MotherMaidenName.Text = NullControl(anneKizlikSoyad)
                        If birthDay.Length = 1 Then
                            birthDay = "0" + birthDay
                        End If
                        If birthMonth.Length = 1 Then
                            birthMonth = "0" + birthMonth
                        End If


                        TB_AuthorizedPersonBirthdate.Text = birthDay + "." + birthMonth + "." + birthYear

                        'TB_BirthPlaceDistrict.Text = birthPlace
                        TB_RegistiredProvince.Text = NullControl(cityName)
                        TB_RegistiredDistrict.Text = NullControl(countyName)
                        'If gender = "Erkek" Then
                        '    DDL_ADR_SEX.SelectedIndex = 1
                        'ElseIf gender = "Kadın" Then
                        '    DDL_ADR_SEX.SelectedIndex = 2
                        'Else
                        '    DDL_ADR_SEX.SelectedIndex = 0
                        'End If
                        lblMernisStatus.Text = 1

                        lblTcIdControlError.Text = persistent.ChangeSIMpersistence.CheckSingleIwisResult(TB_TCNo.Text)
                        If lblTcIdControlError.Text = "OK" Then
                            'btnTCNo.Enabled = True
                        Else
                            'btnTCNo.Enabled = False
                        End If
                        'If persistent.ChangeSIMpersistence.CheckGreyList(TB_TCNo.Text) = "0" Then
                        '    lblTcIdControlError.Text = lblTcIdControlError.Text + " ve " + "TC Kullanıma Uygundur"
                        '    'Button1.Enabled = True

                        'ElseIf persistent.ChangeSIMpersistence.CheckGreyList(TB_TCNo.Text) = "1" Then
                        '    lblTcIdControlError.Text = "TC Blacklistedir"
                        '    'Button1.Enabled = False

                        'ElseIf persistent.ChangeSIMpersistence.CheckGreyList(TB_TCNo.Text) = "11" Then
                        '    lblTcIdControlError.Text = "TC Greylistdedir"
                        '    'Button1.Enabled = False

                        'Else
                        '    lblTcIdControlError.Text = "TC Kullanıma Uygun Değildir"
                        'End If

                    Else

                        lblTcIdControlError.Text = "TC No geçerli değildir Lütfen tekrar deneyiniz"
                        lblMernisStatus.Text = 2

                        Me.Page.RegisterStartupScript("javascript", "<script language=""javascript"">alert('TC No geçerli değildir Lütfen tekrar deneyiniz');</script>")

                    End If

                Else

                    lblTcIdControlError.Text = "TC No Alanı 11 Karakter Olmalıdır."

                    Me.Page.RegisterStartupScript("javascript", "<script language=""javascript"">alert('TC No Alanı 11 Karakter Olmalıdır');</script>")






                End If
            Catch ex As Exception
                Me.Page.RegisterStartupScript("javascript", "<script language=""javascript"">alert('TC No Alanı Harf İçermez.');</script>")
            End Try


        End If
    End Sub
    Public Shared Function NullControl(ByVal text As String) As String

        If text = "null" Then
            Return ""
        Else
            Return text
        End If



    End Function

    

    Protected Sub btnCustomerName_Click(sender As Object, e As EventArgs) Handles btnCustomerName.Click
        Try
            Dim pin_customer_id As Integer = Convert.ToInt32(lblCustomerID.Text)

            Dim custname As String = TB_NAME.Text


            Dim dt As DataTable = UpdateCustomerName(pin_customer_id, custname)
            If dt.Rows.Count > 0 Then
                For Each dr2 As DataRow In dt.Rows
                    If (dr2("result").ToString() = "0") Then

                        Label1.Text = "Güncelleme İşlemi Başarıyla Gerçekleşti"

                    Else
                        Label1.Text = "Güncelleme İşleminde Hata Oluşmuştur "
                    End If
                Next
            End If
        Catch ex As Exception


            Session("message") = ex.Message
            Response.Clear()
            Response.Status = "302 Object Moved"
            Response.RedirectLocation = "CX_Exception.aspx"
            Response.End()




        End Try
    End Sub
End Class